package com.huadao.cart_ccs.data.bo;

import com.huadao.cart_ccs.R;
import com.huadao.cart_ccs.main.CartApplication;

/**
 * //磁力搅拌电机
 */
public class MagneticStirrerBO extends BaseBO {
    private int speed;
    private byte direction;

    public static final byte ModularType_MagneticStirrer =0x2;
    public static final byte magneticStirrer_NO1 = 0x01;//磁力搅拌电机

    public static final byte stop = (byte) 0xAA;//停止
    public static final byte star = (byte) 0xCC;//启动

    public static final byte directionReverse = (byte) 0x00;//反向
    public static final byte directionForward = (byte) 0xFF;//正向

    public MagneticStirrerBO() {
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public byte getDirection() {
        return direction;
    }

    public void setDirection(byte direction) {
        this.direction = direction;
    }

    @Override
    protected String getOrderStr() {
        String orderStr = null;
        if (order == star) {
            orderStr = CartApplication.getInstance().getString(R.string.star);
        } else if (order == stop) {
            orderStr = CartApplication.getInstance().getString(R.string.stop);
        }
        return orderStr;
    }

    @Override
    protected String getOrderContentStr() {
        if (order == stop) {
            return "";
        }
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("转速:");
        stringBuilder.append(speed);
        String directionStr = "";
        if (direction == directionForward) {
            directionStr = CartApplication.getInstance().getString(R.string.directionForward);
        } else if (direction == directionReverse) {
            directionStr = CartApplication.getInstance().getString(R.string.directionReverse);
        }
        stringBuilder.append("转向:");
        stringBuilder.append(directionStr);
        return stringBuilder.toString();
    }

    @Override
    protected String getModularTypeStr() {
        return CartApplication.getInstance().getString(R.string.magnetic_stirrer);
    }
}
